package com.khalil.kkadmin.infrastructure.jpa.domain;

import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.Transient;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@MappedSuperclass
@Setter
@Getter
public class TreeEntityBase<T, K> extends EntityBase<K> {

    /**
     * 父节点ID
     */
    private K parentId;

    /**
     * 父节点
     */
    @Transient
    private T parent;

    /**
     * 树路径
     */
    private String treePath;

    /**
     * 显示顺序
     */
    private Integer orderNum;

    @Transient
    private List<T> children = new ArrayList<>();

}
